import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import axios from 'axios'

import * as echarts from 'echarts';//引入echarts
Vue.prototype.$echarts = echarts //引入组件

import './assets/css/index.less'
//导入NProgress 包对应的js和css
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

//设置跟路径
axios.defaults.baseURL = 'http://121.199.58.229:8180';

//（request拦截器）在发送请求时，事先在请求头中设置token,并且在这个地方展示进度条,NProgress.start()
axios.interceptors.request.use(config => {
  NProgress.start();
  config.headers.Authorization = window.sessionStorage.getItem("token")
  //必须return config
  return config;
});

//在Response拦截器中，隐藏进度条 NProgress.done()
axios.interceptors.response.use(config => {
  NProgress.done();
  return config;
});

Vue.prototype.$http = axios;

Vue.config.productionTip = false


new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
